Work when the entry is not realized. (#392315, Yevgen Muntyan)
authorMatthias Clasen <mclasen@redhat.com>
Wed, 3 Jan 2007 16:10:15 +0000 (16:10 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 3 Jan 2007 16:10:15 +0000 (16:10 +0000)
2007-01-03  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkentry.c (get_text_area_size): Work when the
        entry is not realized.  (#392315, Yevgen Muntyan)

        * gtk/gtkentry.c (gtk_entry_queue_draw): Use
        GTK_WIDGET_DRAWABLE() here.  (#392227, Chris Wilson)

        * gtk/gtkentry.c (cursor_blinks): Don't get settings
        unnecessarily.  (#392227)

svn path=/trunk/; revision=17030

ChangeLog
gtk/gtkentry.c

index d9e7270760e8c142a1fb6b4235ff11fafdc70d37..049999e630e42bc47bd79a1fed6a315158bf0569 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-01-03  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkentry.c (get_text_area_size): Work when the
+       entry is not realized.  (#392315, Yevgen Muntyan)
+
+       * gtk/gtkentry.c (gtk_entry_queue_draw): Use 
+       GTK_WIDGET_DRAWABLE() here.  (#392227, Chris Wilson)
+
+       * gtk/gtkentry.c (cursor_blinks): Don't get settings
+       unnecessarily.  (#392227)
+
 2007-01-02  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkwindow.c (gtk_window_move_resize): Only process
index a489064f65c7944abfd627e755b5fb3b08540eae..de238598dde34a1e58fb4a5c57c346c004716391 100644 (file)
@@ -1389,15 +1389,17 @@ get_text_area_size (GtkEntry *entry,
                         "focus-line-width", &focus_width,
                         NULL);
 
-  gdk_drawable_get_size (widget->window, NULL, &frame_height);
-
-  if (GTK_WIDGET_HAS_FOCUS (widget) && !interior_focus)
-      height -= 2 * focus_width;
-  
   gtk_widget_get_child_requisition (widget, &requisition);
-
   _gtk_entry_get_borders (entry, &xborder, &yborder);
 
+  if (GTK_WIDGET_REALIZED (widget))
+    gdk_drawable_get_size (widget->window, NULL, &frame_height);
+  else
+    frame_height = requisition.height;
+
+  if (GTK_WIDGET_HAS_FOCUS (widget) && !interior_focus)
+      frame_height -= 2 * focus_width;
+
   if (x)
     *x = xborder;
 
@@ -3620,7 +3622,7 @@ gtk_entry_draw_cursor (GtkEntry  *entry,
 static void
 gtk_entry_queue_draw (GtkEntry *entry)
 {
-  if (GTK_WIDGET_REALIZED (entry))
+  if (GTK_WIDGET_DRAWABLE (entry))
     gdk_window_invalidate_rect (entry->text_area, NULL, FALSE);
 }
 
@@ -5338,14 +5340,16 @@ gtk_entry_drag_data_delete (GtkWidget      *widget,
 static gboolean
 cursor_blinks (GtkEntry *entry)
 {
-  GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (entry));
-  gboolean blink;
-
   if (GTK_WIDGET_HAS_FOCUS (entry) &&
       entry->editable &&
       entry->selection_bound == entry->current_pos)
     {
+      GtkSettings *settings;
+      gboolean blink;
+
+      settings = gtk_widget_get_settings (GTK_WIDGET (entry));
       g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
+
       return blink;
     }
   else